package com.wanmait.teatrain.utils;

import com.wanmait.teatrain.entity.Admin;

import javax.servlet.http.HttpServletRequest;

public class SysContext {
    private static ThreadLocal<HttpServletRequest> requestThreadLocal = new ThreadLocal<>();
    private static ThreadLocal<Admin> adminThreadLocal = new ThreadLocal<>();
    private static ThreadLocal<Integer> pageThreadLocal = new ThreadLocal<>();

    public static void setAdmin(Admin admin) {
        adminThreadLocal.set(admin);
    }
    public static Admin getAdmin() {
        return adminThreadLocal.get();
    }
    public static void setPageNum(Integer pageNum) {
        pageThreadLocal.set(pageNum);
    }
    public static Integer getPageNum() {
        return pageThreadLocal.get();
    }
    public static void removePageNum() {
        pageThreadLocal.remove();
    }
    public static void removeAdmin() {
        adminThreadLocal.remove();
    }
}
